package net.risesoft.repository.jpa;

import java.util.List;

import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import net.risesoft.entity.SignDeptDetail;
import net.risesoft.enums.SignDeptDetailStatusEnum;

/**
 * @author qinman
 */
public interface SignDeptDetailRepository
    extends JpaRepository<SignDeptDetail, String>, JpaSpecificationExecutor<SignDeptDetail> {
    List<SignDeptDetail> findByProcessSerialNumberAndDeptIdOrderByCreateTimeDesc(String processSerialNumber,
        String deptId);

    List<SignDeptDetail> findByProcessSerialNumber(String processSerialNumber, Sort sort);

    List<SignDeptDetail> findByProcessSerialNumberAndStatusOrderByCreateTimeDesc(String processSerialNumber,
        SignDeptDetailStatusEnum status);

    List<SignDeptDetail> findByProcessInstanceIdAndStatusOrderByCreateTimeDesc(String processInstanceId,
        SignDeptDetailStatusEnum status);

    List<SignDeptDetail> findByTaskIdOrderByCreateTimeAsc(String taskId);

    SignDeptDetail findByExecutionIdAndDeptId(String executionId, String deptId);

    List<SignDeptDetail> findByProcessSerialNumberAndDeptIdAndStatusOrderByCreateTimeDesc(String processSerialNumber,
        String deptId, SignDeptDetailStatusEnum status);
}
